import {
  get_comment_list,
  get_reply_list,
  comment_note,
  reply_comment,
} from '@/api/note_space.js'

export const send = async (data, is_reply = false) => {
  let res
  if (!is_reply) {
    res = await comment_note(data).catch(() => null)
  } else {
    res = await reply_comment(data).catch(() => null)
  }
  if (!res) return 0
  const {last_id} = res
  return last_id
}

export const httpGetListApi = async (data) => {
  return await get_comment_list(data).catch(() => [])
}

export const httpGetReplyApi = async (data) => {
  return await get_reply_list(data).catch(() => [])
}